package cn.abcsys.devops.client.netty.exec;

import com.fasterxml.jackson.core.type.TypeReference;

import cn.abcsys.devops.client.api.command.InfoCmd;
import cn.abcsys.devops.client.api.model.Info;
import cn.abcsys.devops.client.core.DockerClientConfig;
import cn.abcsys.devops.client.netty.WebTarget;

/**
 * http://stackoverflow.com/questions/33296749/netty-connect-to-unix-domain- socket-failed http://netty.io/wiki/native-transports.html
 * https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/ example/http/snoop/HttpSnoopClient.java
 *
 * @author Marcus Linke
 *
 */
public class InfoCmdExec implements InfoCmd.Exec {

    private WebTarget webResource;

    public InfoCmdExec(WebTarget webResource, DockerClientConfig dockerClientConfig) {
        this.webResource = webResource;
    }

    @Override
    public Info exec(InfoCmd command) {
        return webResource.path("info").request().get(new TypeReference<Info>() {
        });
    }

}
